package com.itheima.d2_byte_stream;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;

/*
     目标：掌握文件字节输出流FileOutputStream的使用。
 */
public class FileOutputStreamTest4 {
    public static void main(String[] args) throws Exception {
        FileOutputStream fileOutputStream = new FileOutputStream("bc.txt",true);
        //写一个字节 字节和ASC码的字符集可以匹配
        fileOutputStream.write(97);

        byte[] bytes = new byte[]{97, 98, 99};
        fileOutputStream.write(bytes);
        fileOutputStream.write(bytes,1,2);
        fileOutputStream.write("32121".getBytes());

        for(int i=0;i<10;i++){
            fileOutputStream.write("我是你爹".getBytes("GBK"));
//            fileOutputStream.write("\r\n".getBytes());
            fileOutputStream.write(System.lineSeparator().getBytes());
        }

        fileOutputStream.close();
    }
}
